package com.hube.platform.tenant.exception;


import java.text.MessageFormat;

/**
 * @author : Aaron
 * @date : 2022/6/8
 */
public class ApplicationException extends RuntimeException {

    private int code;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public ApplicationException() {
        super();
    }

    public ApplicationException(IError err) {
        super(err.message());
        this.code = err.code();
    }

    public ApplicationException(IError err, Object... formatArguments) {
        super(MessageFormat.format(err.message(), formatArguments));
        this.code = err.code();
    }

    public ApplicationException(String message) {
        super(message);
    }

    public ApplicationException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApplicationException(int code, String message) {
        super(message);
        this.code = code;
    }
}